/*
 * @(#)AbstractProvider.java	1.0 2000/12/14
 *
 * Copyright 2000 Thomas Barnekow. All Rights Reserved.
 *
 * This software is the proprietary information of Thomas Barnekow.
 * Use is subject to license terms.
 */

package tb.provider;

import tb.util.*;

/**
 * This is an abstract base class for implementing new service providers. It uses
 * the {@link ProviderSupport} delegate in order to implement the {@link Provider}
 * operations.
 *
 * @author Thomas Barnekow
 * @version 1.0
 */
public abstract class AbstractProvider extends AbstractNamedObject implements Provider {

	/**
	 * A delegate.
	 */
	private ProviderSupport m_providerSupport;

	/**
	 * Create a service provider.
   *
	 * @param name	    the service provider's qualified name
	 */
  public AbstractProvider(QualifiedName name) {
		super(name);
		m_providerSupport = createProviderSupport();
  }

  /**
   * Create the supporting delegate. Override this factory method in
   * order to replace the default provider support delegate.
   */
  protected ProviderSupport createProviderSupport() {
    return new ProviderSupport(this);
  }

	/**
	 * Get supporting delegate
	 */
	protected ProviderSupport getProviderSupport() {
		return m_providerSupport;
	}

	public void provide(QualifiedName service, QualifiedName entity) {
		m_providerSupport.provide(service, entity);
	}

	public boolean isProvider(QualifiedName service, QualifiedName entity) {
		return m_providerSupport.isProvider(service, entity);
	}
}
